package simple_factory

import (
	"errors"
	"fmt"
)

type Button interface {
	Click()
}

type CircleButton struct {
}

func (b *CircleButton) Click() {
	fmt.Println("click circle button")
}

type RectangleButton struct {
}

func (b *RectangleButton) Click() {
	fmt.Println("click rectangle button")
}

func CreateButton(name string) (Button, error) {
	switch name {
	case "circle":
		return &CircleButton{}, nil
	case "rectangle":
		return &RectangleButton{}, nil
	default:
		return nil, errors.New("invalid button name")
	}
}
